package com.ktjy.aop;


import org.aspectj.lang.JoinPoint;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Arrays;

public class LoggerAspect {
    Logger logger = LoggerFactory.getLogger(LoggerAspect.class);
    public void before(JoinPoint jp){
        logger.info("【LoggerAspect 前置增强】正在调用{}的{}方法。方法入参：{}",
                jp.getTarget(),jp.getSignature().getName(), Arrays.toString(jp.getArgs()));
    }

    public void afterReturning(JoinPoint jp,Object result){
        logger.info("【LoggerAspect 后置增强】正在调用{}的{}方法。方法返回值：{}",
                jp.getTarget(),jp.getSignature().getName(), result);
    }
}
